//获取应用实例
var t = getApp(),
  a = t.requirejs("core"),
  s = t.requirejs("wxParse/wxParse");
Page({
  onReady: function(e) {
    // 使用 wx.createAudioContext 获取 audio 上下文 context
    this.audioCtx = wx.createAudioContext('myAudio')
  },
  data: {
    id: 0,
    dlopenarr: [''],
    like: false,
    display: false,
    show: false,
    source: 1,
    kaiguaninfo: '展开全部名片信息',
    card_id: 0,
    get_phone:true,
    share:false,
    news_num: 0, //未读消息
    fenfa_id:0,
    audioContext:'',
    progress: 0,
    currentTime: '0:00',
    duration: '',
    voice_play: false,
    official_account: wx.canIUse('official-account'),
    tankuang: false, //模态框的状态 true-隐藏 false-显示
    animationData: {},
    config:t.config,
    index_model:0,
    show_red: 0,
    show_chat: 0, // 是否显示聊天
    show_red_temp: 0,
    guide_collect: 0,
    miniapp_name: '',
    red_rid: 0,
    red_logo:0,
    is_copyright: false,//版权不显示
    version: t.version,//当前版本号
    have_card: 0,
  },
  upper(e) {
    console.log(e)
  },

  lower(e) {
    console.log(e)
  },

  scroll(e) {
    console.log(e)
  },

  scrollToTop() {
    this.setAction({
      scrollTop: 0
    })
  },

  tap() {
    for (let i = 0; i < order.length; ++i) {
      if (order[i] === this.data.toView) {
        this.setData({
          toView: order[i + 1],
          scrollTop: (i + 1) * 200
        })
        break
      }
    }
  },

  tapMove() {
    this.setData({
      scrollTop: this.data.scrollTop + 10
    })
  },
  wadaxiwa: function (e) {
    var rid = a.pdata(e).rid;
    this.setData({
      show_red: 2,
      index_model:0
    })
    a.jump('/yb_mingpian/pages/red/red?bug=5&rid=' + rid + '&share_id=-1&share_log_id=0');
  },

  // 红包弹窗关闭
  close_red: function () {
    this.setData({
      show_red: 2,
      index_model:0
    })
  },

  // 引导收藏弹窗关闭
  close_guide: function () {
      this.setData({
          guide_collect: 2
      })
      if (this.data.show_red_temp == 1 && this.data.show_red != 2) {
          this.setData({
              show_red: 1
          })
      }
  },


  // *********************************************
  //点击我显示底部弹出框
  clickme: function () {


    this.showModal_1();
    var o = this;
    var order_sn = o.dingdanhao;

     a.get("Card/CreatCardOrder", {
        uid: getApp().getCache("userinfo").uid,
        order_sn:order_sn
      }, function (res) {
        
      })

     //创建名片订单

      //var o = this;
    },

    clickme1: function () {
      wx.navigateTo({
         url:'../edit/edit',  //跳转页面的路径，可带参数 ？隔开，不同参数用 & 分隔；相对路径，不需要.wxml后缀
         success:function(){},   //结束后的回调(成功，失败都会执行)
      })
    },

  //显示对话框
  showModal_1: function () {
    // 显示遮罩层
    var animation = wx.createAnimation({
      duration: 300,
      timingFunction: "linear",
      delay: 0
    })
    this.animation = animation
    animation.translateY(450).step()
    this.setData({
      animationData: animation.export(),
      showModalStatus: true
    })
    setTimeout(function () {
      animation.translateY(0).step()
      this.setData({
        animationData: animation.export()
      })
    }.bind(this), 200)
  },
  //隐藏对话框
  hideModal_1: function () {
    // 隐藏遮罩层
    var animation = wx.createAnimation({
      duration: 200,
      timingFunction: "linear",
      delay: 0
    })
    this.animation = animation
    animation.translateY(300).step()
    this.setData({
      animationData: animation.export(),
    })
    setTimeout(function () {
      animation.translateY(0).step()
      this.setData({
        animationData: animation.export(),
        showModalStatus: false
      })
    }.bind(this), 200)
  },
  //调起微信支付(名片支付)
  /**
  *调用支付
  * @param out_trade_no 订单号
  * @param openid
  * @return array
  */
  pay: function (k) {
    var o = this;
    o.setData({
      formid: k.detail.formId
    })
    a.get("Pay/CardPay", {
      out_trade_no: o.dingdanhao,
      openid: getApp().getCache("userinfo").openid
    }, function (t) {
      console.log(t)
      0 == t.code ? (
        wx.requestPayment({
          'timeStamp': t.info.timeStamp,
          'nonceStr': t.info.nonceStr,
          'package': t.info.package,
          'signType': 'MD5',
          'paySign': t.info.paySign,
          'success': function (res) {
            if (res.errMsg == "requestPayment:ok") {
              wx.setNavigationBarTitle({
                title: "支付成功"
              });
              o.setData({
                success: true,
                "list.order_status": 1
              });
              // wx.redirectTo({
              //   url: "/yb_mingpian/pages/cardinfo/index"
              // })
              //o. hideModal_1();
              o.onLoad();
              o.onShow();
              o. hideModal_1();
              //推送
              a.get('Wxpush/PayOrderPush', {
                out_trade_no: o.data.list.out_trade_no,
                formid: o.data.formid,
                uid: getApp().getCache("userinfo").uid
              }, function (t) {
                console.log(t)
              });
            } else {
              a.alert('支付失败！')
              wx.redirectTo({
                url: "/yb_mingpian/pages/cardinfo/index"
              })
            }
          },
          'fail': function (res) {
            a.alert('您已经取消支付！')
            wx.redirectTo({
              url: "/yb_mingpian/pages/cardinfo/index"
            })
          }
        })
      ) : (a.alert(t.msg), setTimeout(function () {
        wx.navigateBack()
      }, 1e3))

    })
    return;

  },
  //获取支付订单信息
  get_order_list: function () {
    var t = this;
    a.get("Card/Cardsn", {
      //uid: t.getCache("userinfo").uid,
    }, function (res) {
      t.dingdanhao = res.info
      console.log("Cardsn", res);
    })

  },

  //获取我自己的名片
  get_my_card:function(){
    var o = this
     a.get("Card/GetMycard",{
      uid: t.getCache("userinfo").uid,
     }, function (res) {
       // o.data.have_card = res.code
       o.setData({
        have_card: res.code
      })
      console.log(o.data.have_card);
      //console.log(have_card);
    })
  },
  // ***************************************************

  loginSubmit: function (k) {
    console.log('登录获取表单id')
    var formid = k.detail.formId;
    console.log(formid);
    getApp().setCache('login_formid', formid);

  },
  show_share:function(){
    var share=this.data.share?false:true;
    var modela=this.data.share?0:1;
    this.setData({
      index_model:modela,
      share:share
    })
  },
  onHide:function(){

  },
  onGotUserInfo: function(q) {

    var that = this,
      e = t.getCache("userinfo");

    if (e) {
      that.setData({
        display: false
      })
      //return;
    }
    t.getUserInfo(q.detail.userInfo, function(aa) {
      if (aa != 1000) {
        var ucache = getApp().getCache("userinfo");
        if (ucache && ucache.nickName && ucache.avatarUrl) {
          that.get_card_id(function(){
            that.isLike();
            t.userlog(1, '名片', 'card_browse');
            that.setData({
              card_id: t.globalData.card_id
            });
            that.getInfo();
          })

          // 记录访问信息
          if (that.data.source == 1) {
            that.saveUserLog();
          }

          that.setData({
            display: false,
            getPhoneAuth: getApp().globalData.getphone
          })
        }

      } else {
        that.setData({
          display: true
        })
      }

    }, q.detail.encryptedData, q.detail.iv);

  },

  // 授权获取用户信息判断
  authCheck: function () {
    var cache = getApp().getCache("userinfo");
    if (!cache.nickName && !cache.avatarUrl) {
      this.setData({
        display: true
      })
      return false;
    } else {
      this.setData({
        display: false
      })
      return true;
    }
  },

    // 取消登录
    cancel_auth: function () {
        this.setData({
            display: false
        })
    },

  dlopenclose: function(e) {
    var that = this;
    var getxh = e.currentTarget.dataset.id;
    var dataarr = that.data.dlopenarr;
    var getopenarr = dataarr[getxh];
    var lastval;
    if (getopenarr == 'open') {
      lastval = '';
      that.setData({
        kaiguaninfo: '展开全部名片信息'
      });
    } else {
      lastval = 'open';
      that.setData({
        kaiguaninfo: '收起以下名片信息'
      });
    } //if end
    dataarr[getxh] = lastval;
    that.setData({
      dlopenarr: dataarr
    });
  },

  onLoad: function(e) {
    console.log(e,'名片列表带来的数据')
    var that = this;

    var che = getApp().getCache("userinfo");
    if (!che.nickName && !che.avatarUrl) {
      getApp().authSwitch(function(res){
        if (res == 1) {
          that.setData({
            display: true
          })
        } else {
          that.setData({
            display: false
          })
        }
      })
    }

    t.set_caidan(function(){
      a.setting();
      that.setData({
        config: getApp().config
      })
    });
    if (e && e.id) {
      t.globalData.card_id = e.id;
    }
    if (e && e.pid) {
      t.setCache('pid', e.pid);
    }
    console.log("a2", e.pid);

    if (e && e.scene) {
        var scene = decodeURIComponent(e.scene);
        scene = scene.split(',');
        e.id = scene[0];

        // 后台分发时scene是负数
        if (e.id < 0) {
            e.id = -e.id;
            that.setData({fenfa_id: e.id})
        } else {
            t.globalData.card_id = e.id;
        }
        console.log("e.id",e.id);

        t.globalData.user_source = 2;
        e.source = 2;
    }

    if (e.source != undefined) {
      t.globalData.user_source = e.source;
    }

    that.setData({
      source: e.source != undefined ? e.source : 1
    });

    that.setData(e);
    console.log("opt",that.data)
    if(!t.globalData.card_id){
      that.getDefaultCard();
    }
  },
  getDefaultCard: function (cb) {
    let that = this
    wx.request({
      url: t.siteInfo.siteroot + '?i=' + t.siteInfo.uniacid + '&t=undefined&from=wxapp&c=entry&a=wxapp&do=boss_card&m=yb_mingpian&sign=1d917db727d0aa4e23ca117826fa3153' + '&v=' + t.version,
      data: {
        uid: t.getCache('userinfo').uid != undefined ? t.getCache('userinfo').uid : 0
      },
      header: {
        'content-type': 'application/json' // 默认值
      },
      success: function (m) {
        t.globalData.card_id = m.data.info
        if (cb != undefined && t.globalData.card_id){
          cb();
          return true
        }
      },
      fail:function(){
        setTimeout(function () {
          that.to_cardlist();
        }, 10)
      }
    });
  },
  // 保存用户访问记录,source为1时
  saveUserLog: function () {
    var that = this;

    // 不授权不成为客户
    if (!t.getCache("userinfo").nickName && !t.getCache("userinfo").avatarUrl) {
      return;
    }

    a.get("Card/GoodsCardList", {
      uid: t.getCache("userinfo").uid,
      staff_id: t.globalData.card_id,
      source: that.data.source
    }, function (res) {
      console.log("visit1", res);
    })
  },

  // 获取用户手机号
  getMobile: function (e) {
    t.globalData.getphone = false;
    this.setData({
      getPhoneAuth: false
    })
    t.getPhoneNumber(e, this, 3);
  },

  //获取随机员工id
  get_card_id:function(obj){
    if (this.data.fenfa_id==0 || t.globalData.card_id>0){
      typeof obj == "function" && obj(22);
    }else{
      var that = this;
      a.get('Card/sendcard', { id: that.data.fenfa_id }, function (tt) {
        console.log("aaa", that.data.fenfa_id);
        if (tt.code == 0) {
          t.globalData.card_id = parseInt(tt.info);
          that.setData({
            card_id: t.globalData.card_id
          })
          typeof obj == "function" && obj(11)
        } else {
          a.alert(tt.msg);
          return;
        }
      })
    }

  },
  onShow: function() {
    var modela = this.data.share ? 1: 0;
    this.setData({
      index_model: modela
    })
    var that = this;
    var che = t.getCache("userinfo");
    //if (che) {
      that.get_card_id(function () {
          that.setData({
            card_id: t.globalData.card_id,
            //display: false
          })
          if (t.globalData.card_id == 0) {
            that.getDefaultCard(function(){
              that.getCardPageInfo();
            });
            return true;
          }
        that.getCardPageInfo();
      })
    //}
  },
  getCardPageInfo:function(){
    var that = this;
    that.getInfo();
    that.isLike();

    // 记录访问信息
    if (that.data.source == 1) {
      that.saveUserLog();
    }

    //语音总时长
    var id = t.globalData.card_id;
    var cache_d = t.getCache('duration_' + id);
    if (cache_d) {
      that.setData({
        duration: cache_d
      })
    }
  },
  isLike: function() {
    var that = this;
    a.get('Card/isLike', {
      c_id: t.globalData.card_id,
      user_id: t.getCache('userinfo').uid != undefined ? t.getCache('userinfo').uid : 0,
      type_zan: 1
    }, function(t) {
      console.log(t)
      if (t.code == 0) {
        that.setData({
          like: true
        })
      }
    })

    console.log("source",that.data.source)

    // 不授权不成为客户
    if (!t.getCache('userinfo').nickName && !t.getCache('userinfo').avatarUrl) {
      return;
    }

    // 记录用户访问名片的途径，source为2和3时
    if (that.data.source != 1) {
      a.get('Card/SaveCard', {
        staff_id: t.globalData.card_id,
        user_id: t.getCache('userinfo').uid,
        source: that.data.source,
        fenfa_id: that.data.fenfa_id
      }, function (t) {
        console.log('visit2/3', t)
      })
    }
  },

  to_cardlist: function() {
    a.jump('/yb_mingpian/pages/card/card');
  },

  getInfo: function() {

    this.get_order_list();
    this.get_my_card();
    var that = this,
        id = that.data.id;

    var ol = that.data.show_red;
    var gc = that.data.guide_collect;

    t.get_news_num(that);
    var pid=that.data.pid;
    t.userlog(1, '名片', 'card_browse');
    a.get('Card/CardInfo', {
      id: t.globalData.card_id,
      //user:id,
      pid:pid?pid:0,
      uid:getApp().getCache('userinfo').uid
    }, function(t) {
      console.log("cardinfo",t)
      if (t.code == 0) {
        that.setData({
            miniapp_name: t.info.miniapp_name,
            show_chat: t.info.show_chat
        })
        if (t.info.guide_collect == 1 && t.info.show_red == 1) {
            that.setData({
                show_red_temp: 1
            })
        }

        if (gc != 2) {
            that.setData({
                guide_collect: t.info.guide_collect
            })
        }

        if (ol != 2) {
          that.setData({
            red_logo: t.info.red_logo,
            show_red: that.data.show_red_temp == 0 ? t.info.show_red : 0,
            red_rid: t.info.rid,
            index_model: 1
          })
          if (that.data.show_red==0){
            that.setData({
              index_model: 0
            })
          }
        }

        if (t.info.is_relay!=1){
          wx.hideShareMenu();
        }
        that.audioContext = wx.createAudioContext('audio');
        t.info.likes = parseInt(t.info.likes)
        that.setData({
            show: true,
            info: t.info,
            miniapp_name: t.info.miniapp_name
        })
        var tmp1 = t.info.profile;
        if (tmp1 == "" || tmp1 == null || tmp1 == undefined) {
          tmp1 = "我的个人简介";
        }
        console.log("profile",t.info)
        that.setData({
          "info.profile": tmp1.replace(/\<img/gi, '<img style="max-width:100%;height:auto" '),
        })
        //显示弹框
       // that.showModal();
      } else {
       // a.alert(t.msg);
      }
    }, !that.data.show);
  },

  previewImage: function(e) {
    var that = this,
      url = that.data.info.head_photo;
    wx.previewImage({
      current: url, // 当前显示图片的http链接
      urls: [url] // 需要预览的图片http链接列表
    })
  },
  my_photo: function(e) {
    var that = this,
      index = a.pdata(e).index,
      url = that.data.info.pic_arr;
    wx.previewImage({
      current: url[index], // 当前显示图片的http链接
      urls: url // 需要预览的图片http链接列表
    })
  },

  Clipboard: function(e) {
    var i = a.pdata(e);
    t.userlog(3, i.type, 'cardinfo_copy');
    console.log("Clipboard",e)
    a.Clipboard(i.i);
  },
  phone: function(e) {
    t.userlog(5, '电话', 'cardinfo_call');
    a.phone(e);
  },

  // 添加手机通讯录
  addPhoneContact: function() {
    console.log(456)
    t.userlog(4, '名片', 'cardinfo_save');
    var i = this.data.info;
    wx.addPhoneContact({
      firstName: i.user_name,
      mobilePhoneNumber: i.tel ? i.tel : '',
      weChatNumber: i.wechat_number ? i.wechat_number : '',
      organization: i.bus && i.bus.name ? i.bus.name : '',
      title: i.position ? i.position : '',
      workPhoneNumber: i.phone ? i.phone : '',
    })
  },

  likes: function() {
    var that = this;
    a.get('Card/Zan', {
      c_id: t.globalData.card_id,
      user_id: getApp().getCache('userinfo').uid,
      type_zan: 1,
    }, function(t) {
      if (t.code == 0) {
        var likes = that.data.info.likes;
        if (that.data.like) {
          likes = likes - 1;
        } else {
          likes = likes + 1;
        }
        that.setData({
          like: that.data.like ? false : true,
          'info.likes': likes >= 0 ? likes : 0
        })
      }
    })
  },
  effect_tag: function(e) {
    var that = this,
      i = a.pdata(e).index,
      list = that.data.info.effect_tag;
    list[i] = parseInt(list[i]) + 1;
    var cache = t.getCache('tag_' + i);
    if (cache) {
      return;
    }
    a.get('Card/SaveEffectTag', {
      id: t.globalData.card_id,
      data: JSON.stringify(list)
    }, function(t) {
      console.log(t)
      if (t.code == 0) {
        getApp().setCache('tag_' + i, i, 3600);
        that.setData({
          "info.effect_tag": list
        })
      }
    })
  },
  to_goods: function(e) {
    console.log(222);
    if (this.data.index_model>0){
      return;
    }
    var id = a.pdata(e).id;
    var type=a.pdata(e).type;
    if (id == 0) {
      a.jump('/yb_mingpian/pages/product/index');
    } else {
      if(id==-1){
        a.jump('/yb_mingpian/pages/product/list/index')
      }else{
        if(type=="product"){
          a.jump('/yb_mingpian/pages/product/info/index?id=' + id)
        }else{
          a.jump('/yb_mingpian/pages/goods/detail/index?id=' + id)
        }
      }
    }
  },
  //跳转+收集表单id
  formSubmit: function(k) {
    var e = {};
    e.formid = k.detail.formId;
    e.openid = getApp().getCache("userinfo").openid;
    e.username = getApp().getCache("userinfo").nickName;
    a.get('Market/getFormid', e, function(t) {
      console.log(t)
    })
    a.jump('/yb_mingpian/pages/chats/chats');
  },
  bindconfirm: function (k) {
    var e = {};
    e.formid = k.detail.formId;
    e.openid = getApp().getCache("userinfo").openid;
    e.username = getApp().getCache("userinfo").nickName;
    console.log("form",e)
    a.get('Market/getFormid', e, function (t) {
      console.log(t)
    })
  },

  // 生成海报
  to_poster:function(){
    this.setData({
      share: false
    })
    var data=this.data.info,
    address='';
    if (data.bus && data.bus.address){
      address = data.bus.address;
    }
    a.jump('/yb_mingpian/pages/poster2/index?id=' + data.id + '&img=' + data.head_photo + '&user_name=' + data.user_name + '&position=' + data.position + '&tel=' + data.tel + '&wechat_number=' + data.wechat_number + '&address=' + address +'&share_type=card1');
  },

  to_chat: function() {
    a.jump('/yb_mingpian/pages/chats/chats');
  },
    // 聊天获取手机号
  getPhoneNumber: function(e) {
    t.getPhoneNumber(e,this,1);
  },
  getPhoneNumber2: function (e) {
    t.getPhoneNumber(e, this, 2);
  },
  getPhoneNumber3: function (e) {
    console.log(456);
    t.getPhoneNumber(e, this, 3);
  },

  /**
   * 下拉刷新
   */
  onPullDownRefresh: function() {
    this.getInfo();
    this.isLike();
    wx.stopPullDownRefresh();
  },
  //音频播放
  //以下是状态监听
  audioError: function (resp) {
    console.log(resp);
  },
  audioPlay: function (resp) {
    console.log(resp);
    console.log('开始播放');
    this.setData({
      voice_play:true
    })
  },
  playEnd: function (resp) {
    var duration='',
    cache_d = t.getCache('duration_' + this.info.id);
    if (cache_d){
      duration = cache_d;
    }
    that.setData({
      progress: 0,
      currentTime: '0:00',
      voice_play: false,
      duration: duration
    })
  },
  timeUpdate: function (resp) {
    var currentTime = this.miao_to_time(resp.detail.currentTime),
      duration = this.miao_to_time(resp.detail.duration);
    var id = t.globalData.card_id;
    var cache_d = t.getCache('duration_' + id);
    if (!cache_d){
      t.setCache('duration_' + id, duration);
    }
    var progress = parseInt((resp.detail.currentTime / resp.detail.duration) * 100)
    var that = this;
    that.setData({
      progress: progress,
      currentTime: currentTime,
      duration: duration
    })
  },
  miao_to_time: function (currentTime) {
    currentTime = Math.round(currentTime);
    var a = currentTime - Math.floor(currentTime / 60) * 60;
    a = a.toString();
    if (a.length == 1) {
      a = '0' + a;
    }
    return Math.floor(currentTime / 60) + ":" + a;
  },
  //以下是操作
  play: function () {
    this.audioContext.play();
    this.setData({
      voice_play: true
    })
  },
  pause: function () {
    this.audioContext.pause();
    this.setData({
      voice_play: false
    })
  },
  official_account_load: function (e) {
    console.log("official_account_load");
    console.log(e);
  },

  official_account_err: function (e) {
    console.log("official_account_err");
    console.log(e);
  },

  // 显示遮罩层

  showModal: function () {

    var that = this;

    that.setData({

      tankuang: true

    })

    var animation = wx.createAnimation({

      duration: 800,//动画的持续时间 默认400ms 数值越大，动画越慢 数值越小，动画越快

      timingFunction: 'ease',//动画的效果 默认值是linear

    })

    this.animation = animation

    setTimeout(function () {

      that.fadeIn();//调用显示动画

    }, 200)

  },



  // 隐藏遮罩层

  hideModal: function () {

    var that = this;

    var animation = wx.createAnimation({

      duration: 800,//动画的持续时间 默认400ms 数值越大，动画越慢 数值越小，动画越快

      timingFunction: 'ease',//动画的效果 默认值是linear

    })

    this.animation = animation

    that.fadeDown();//调用隐藏动画

    setTimeout(function () {

      that.setData({

        tankuang: false

      })

    },

      720)//先执行下滑动画，再隐藏模块



  },



  //动画集

  fadeIn: function () {

    this.animation.translateY(0).step()

    this.setData({

      animationData: this.animation.export()//动画实例的export方法导出动画数据传递给组件的animation属性

    })

  },

  fadeDown: function () {

    this.animation.translateY(300).step()

    this.setData({

      animationData: this.animation.export(),

    })

  },
  //分享
  onShareAppMessage: function() {
    this.setData({
      share:false,
      index_model:0
    })
    t.userlog(2, '名片', 'card_relay');
    var title = this.data.info.share_title;
    if(title=='' || title==null){
      if (this.data.info.bus){
        title = '你好,我是' + this.data.info.bus.name + '的' + this.data.info.user_name + ',这是我的名片请惠存';
      }else{
        title = '你好,我是' + this.data.info.user_name + ',这是我的名片请惠存';
      }
    }
    console.log(t.globalData.card_id,101);
    console.log(title, 102);
     var uid = getApp().getCache('userinfo').uid ? getApp().getCache('userinfo').uid : 0;
    var path = 'yb_mingpian/pages/cardinfo/index?source=3&id=' + t.globalData.card_id + '&pid=' + uid;
    console.log(path);
    return {
      title: title,
      path: path,
    }
  },

  /**
   * 名片码
   */
  cardCode: function () {
    var card_info = {
      'head_photo': this.data.info.head_photo,
      'user_name': this.data.info.user_name,
      'card_id': this.data.info.id,
      'position': this.data.info.position,
      'share_title': this.data.info.share_title,
      'company_name': this.data.info.bus ? this.data.info.bus.name : '',
    }
    card_info = JSON.stringify(card_info);
    // 进行编码，防止特殊符号在解析时报错
    card_info = encodeURIComponent(card_info);
    console.log("code_info",card_info)
    a.jump("/yb_mingpian/pages/card_qr/card_qr?card_info="+card_info,1)
  },

  /**
   * 地图导航
   */
  navigation: function (e) {
    var bus_info = this.data.info.bus;
    var address = bus_info.address ? bus_info.address : '';

    if (bus_info.lat && bus_info.lng) {
      a.tx_map(bus_info.lat, bus_info.lng, address, bus_info.name)
    } else {
      a.toast('不能获取到该位置')
    }
  },

  //长按版权展示
  copyright: function () {
    var that = this,
      i = that.data.is_copyright;
    that.setData({
      is_copyright: i ? false : true
    })
  },
})